package com.enjoy.rpc.base;

import org.springframework.stereotype.Component;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

@Component
public class RegistryService {

    private static final Map<String, Class<?>> serviceCache = new ConcurrentHashMap<>();


    //注册服务
    public void regService(String serviceName,Class<?> impl){
        serviceCache.put(serviceName, impl);
    }

    //发现服务
    public Class<?> getService(String serviceName){
        return serviceCache.get(serviceName);
    }
}



